package com.yhn.bubblevideo.common.exception;


import com.yhn.bubblevideo.common.enums.IErrorCode;
import lombok.Getter;


/**
 * 自定义异常类
 *
 * @author yhnyhn123
 */
@Getter
public class BusinessException extends RuntimeException {

    /**
     * 错误码
     */
    private final String code;

    public BusinessException(String code, String message) {
        super(message);
        this.code = code;
    }

    public BusinessException(String message) {
        super(message);
        this.code = "500";
    }

    public BusinessException(IErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.code();
    }

    public BusinessException(IErrorCode errorCode) {
        super(errorCode.message());
        this.code = errorCode.code();
    }

}
